var webpack = require('webpack');
var path = require('path');
module.exports = {
  entry: {
    app: [
    './static/frontend/app.js'], //入口js
    vendor: ['react','react-dom','react-intl','react-redux','react-router','redux-thunk','redux-actions']
  },
  output: {
    path: path.resolve(__dirname, 'static/dist-static'),
    filename: '[name].build.js' //输出js
  },

  module: {
    loaders: [{
      test: /\.jsx?$/,
      exclude: /node_modules/,
      loaders: ['babel-loader?presets[]=es2015&presets[]=react']
    },
    {
      test: /\.scss$/,
      loaders:['style','css','sass?includePaths[]=./static/style/index.scss']
    },
    { test: /\.css$/, loader: "style-loader!css-loader" }
    ]
  },
  plugins: [
    new webpack.optimize.CommonsChunkPlugin('vendor', 'vendor.bundle.js'),
    new webpack.ProvidePlugin({
      React: "react",
      ReactDOM: "react-dom",
    }),
    new webpack.DefinePlugin({ //配置开发环境变量
      "process.env": {
        NODE_ENV: JSON.stringify("production") //development,production
      }
    }),
    new webpack.optimize.UglifyJsPlugin({ //是否启用压缩
      compress: {
          warnings: false
      }
    })
  ],
};